for ifrom, linkfrom, ito, linkto in layout.sblinks:
if linkto is view:
sbviews[ito] = (ifrom, linkfrom)
def scroller(x, y, view=view, hlink=sbviews[0], vlink=sbviews[1]):
view.scrollto(x, y)
if hlink is not None:
if hlink[0]:
hlink[1].scrollto(None, x)
else:
hlink[1].scrollto(x, None)
if vlink is not None:
if vlink[0]:
vlink[1].scrollto(None, y)
else:
vlink[1].scrollto(y, None)
if not MapOption("AxisXYZ") and not MapOption("All2DviewsScale") and not MapOption("XviewScale") and not MapOption("YviewScale") and not MapOption("ZviewScale"):
view.update()
else:
view.repaint()
return scroller
quarkpy.qhandles.MakeScroller = MyMakeScroller
# The following sets the canvas function to draw the images.
cv = view.canvas()
grid = editor.gridstep # Gives grid setting
gridunits = quarkx.ftos(grid) # Converts float nbr to string
type = view.info["type"] # These type values are set
# in the layout-defining plugins.
if type == "YZ":
if not MapOption("XviewScale") and not MapOption("All2DviewsScale"):
return
YZarea = `view.clientarea` # Gets the view area as a string
pixels = YZarea.replace("(","") # trims ( from YZarea
pixels = pixels.replace(")","") # trims ) from YZarea
pixels = pixels.split(",") # trims , from YZarea
Ystring = pixels[0] # pulls out y factor string
Zstring = pixels[1].strip() # pulls out z factor string
Ypixels = int(Ystring) # converts y string to intiger nbr
Zpixels = int(Zstring) # converts z string to intiger nbr
X0 = quarkpy.qmenu.item("All 2D views", All2DviewsClick, "|All 2D views:\n\nIf this menu item is checked, it will display a scale of the current grid setting in all 2D views and deactivate this menu's individual items.|intro.mapeditor.menu.html#optionsmenu")
X1 = quarkpy.qmenu.item("X-Face 2D view", XviewScaleClick, "|X-Face 2D view:\n\nIf this menu item is checked, it will display a scale of the current grid setting in the ' X - Face ' 2D view and deactivate this menu's 'All 2D views' item if it is currently checked.|intro.mapeditor.menu.html#optionsmenu")
X2 = quarkpy.qmenu.item("Y-Side 2D view", YviewScaleClick, "|Y-Side 2D view:\n\nIf this menu item is checked, it will display a scale of the current grid setting in the ' Y-Side ' 2D view and deactivate this menu's 'All 2D views' item if it is currently checked.|intro.mapeditor.menu.html#optionsmenu")
X3 = quarkpy.qmenu.item("Z-Top 2D view", ZviewScaleClick, "|Z-Top 2D view:\n\nIf this menu item is checked, it will display a scale of the current grid setting in the ' Z-Top ' 2D view and deactivate this menu's 'All 2D views' item if it is currently checked.|intro.mapeditor.menu.html#optionsmenu")
# ******************Creates the Popup menu********************
def ViewAmendMenu1click(m):
editor = mapeditor(SS_MAP)
if editor is None: return
m.items = View2DgridMenu(editor)
GridMenuCmds = [quarkpy.qmenu.popup("Grid scale in 2D views", [], ViewAmendMenu1click, "|Grid scale in 2D views:\n\nThese functions allow you to display a scale of the current grid setting in any one, combination, or all of the 2D views of the Editor.", "intro.mapeditor.menu.html#optionsmenu")]
# ----------- REVISION HISTORY ------------
#
#
#$Log: mapgridscale.py,v $
#Revision 1.4 2003/12/18 21:51:46 peter-b
#Removed reliance on external string library from Python scripts (second try ;-)